 

package com.zdkj.subway.stm.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.stm.entity.SwStTvmDailyBillCashPay;
import com.zdkj.subway.stm.service.SwStTvmDailyBillCashPayService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * TVM日结账单现金信息
 *
 * @author songtuo
 * @date 2020-03-06 13:50:32
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swsttvmdailybillcashpay" )
@Api(value = "swsttvmdailybillcashpay", tags = "TVM日结账单现金信息管理")
public class SwStTvmDailyBillCashPayController {

    private final  SwStTvmDailyBillCashPayService swStTvmDailyBillCashPayService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swStTvmDailyBillCashPay TVM日结账单现金信息
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwStTvmDailyBillCashPayPage(Page page, SwStTvmDailyBillCashPay swStTvmDailyBillCashPay) {
        return R.ok(swStTvmDailyBillCashPayService.page(page, Wrappers.query(swStTvmDailyBillCashPay)));
    }


    /**
     * 通过id查询TVM日结账单现金信息
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swStTvmDailyBillCashPayService.getById(id));
    }

    /**
     * 新增TVM日结账单现金信息
     * @param swStTvmDailyBillCashPay TVM日结账单现金信息
     * @return R
     */
    @ApiOperation(value = "新增TVM日结账单现金信息", notes = "新增TVM日结账单现金信息")
    @SysLog("新增TVM日结账单现金信息" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('generator_swsttvmdailybillcashpay_add')" )
    public R save(@RequestBody SwStTvmDailyBillCashPay swStTvmDailyBillCashPay) {
        return R.ok(swStTvmDailyBillCashPayService.save(swStTvmDailyBillCashPay));
    }

    /**
     * 修改TVM日结账单现金信息
     * @param swStTvmDailyBillCashPay TVM日结账单现金信息
     * @return R
     */
    @ApiOperation(value = "修改TVM日结账单现金信息", notes = "修改TVM日结账单现金信息")
    @SysLog("修改TVM日结账单现金信息" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('generator_swsttvmdailybillcashpay_edit')" )
    public R updateById(@RequestBody SwStTvmDailyBillCashPay swStTvmDailyBillCashPay) {
        return R.ok(swStTvmDailyBillCashPayService.updateById(swStTvmDailyBillCashPay));
    }

    /**
     * 通过id删除TVM日结账单现金信息
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除TVM日结账单现金信息", notes = "通过id删除TVM日结账单现金信息")
    @SysLog("通过id删除TVM日结账单现金信息" )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('generator_swsttvmdailybillcashpay_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swStTvmDailyBillCashPayService.removeById(id));
    }

}
